import { request } from '@/utils/request';
/**
 * @description 获取角色列表分页
 * @returns
 */
export function getRoleListPage(data) {
  return request({
    url: '/api/orgm/rolesListPage',
    method: 'post',
    data,
  });
}

export function getRolesList(data) {
  return request({
    url: '/api/orgm/rolesList',
    method: 'get',
    data,
  });
}

/**
 * @description 删除角色
 * @returns
 */
export function deleteRole(data: any) {
  return request(
    {
      url: '/api/orgm/deleteRoles',
      method: 'post',
      data,
    },
    {
      successMsg: '删除成功',
    },
  );
}
/**
 * @description 创建角色
 * @returns
 */
export function createRole(data) {
  return request({
    url: '/api/orgm/addRoles',
    method: 'post',
    data,
  });
}

// 更新角色
export function editRole(data) {
  return request({
    url: '/api/orgm/updateRoles',
    method: 'post',
    data,
  });
}

// 角色下用户
export function roleUsers(data) {
  return request({
    url: '/api/orgm/getRoleUsers',
    method: 'get',
    params: data,
  });
}

// 角色下菜单
export function roleMenus(data) {
  return request({
    url: '/api/menu/getRoleMenus',
    method: 'get',
    params: data,
  });
}

// 角色下部门

export function roleDepart(data) {
  return request({
    url: '/api/orgm/roleDeptTreeselect',
    method: 'get',
    params: data,
  });
}

// 获取所有部门列表
export function getAllDepts(data) {
  return request({
    url: '/api/orgm/getDepartmentList',
    method: 'post',
    data,
  });
}
